﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ERPStudio;

namespace ERPForms
{
    /// <summary>
    /// jurnalele sunt peste tot la fel si inn arhive
    /// </summary>
    public partial class JurnaleFrm : FrmRezumat
    {
        private Boolean eUnitateBugetara = false;
        public JurnaleFrm(ModuleClass mInfo,Boolean eB)
            : base(mInfo)
        {
            eUnitateBugetara = eB;
            InitializeComponent();
            workConnString = mInfo.workConnectionString;
            eSRPDataSet.Jurnale.CodUnitateColumn.DefaultValue = ModuleInfo.CodUnitate;
            eSRPDataSet.Jurnale.IDParinteColumn.DefaultValue = 0;
            eSRPDataSet.Jurnale.TerminalColumn.DefaultValue = true;
            ActiveControl = jurnaleDGV;
        }

        private void JurnaleFrm_Load(object sender, EventArgs e)
        {
             if (eUnitateBugetara)
                Text = "Capitole";

            this.listBndSourceMain.Add(jurnaleBindingSource);
            this.listTableAdaptor.Add(this.jurnaleTableAdapter.Adapter);
            SetCurentUnit(ModuleInfo.CodUnitate);
            if (!EsteArhiva())
            {
                AddButton("Salvare", global::ERPStudio.Properties.Resources.salvare1, Salvare, ToolStripItemAlignment.Right, true);
                HandleSalvare += new EventHandler(Salvare);
            }
            
        }
        override public void SetCurentUnit(short vCodUnitate)
        {
            this.jurnaleTableAdapter.Connection = DeschideConexiune(workConnString);
            this.banciTableAdapter.Connection = this.jurnaleTableAdapter.Connection;
            this.banciTableAdapter.Fill(this.eSRPDataSet.Banci);
            this.jurnaleTableAdapter.Fill(this.eSRPDataSet.Jurnale, ModuleInfo.CodUnitate);
            InchideConexiune(this.jurnaleTableAdapter.Connection);
        }

        override public void SetCurentMonth(short vCodUnitate)
        {
            //Setup(conn);
        }
        /// <summary>
        /// cand se apasa enter, controlul activ este luna, anul
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        override public void toolStripLabelAnLuna_Click(object sender, EventArgs e)
        {

        }

    }
    
}
